/****************************************************
          File Name:mq_close.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 20 Sep 2014 09:04:40 AM CST
*****************************************************/

#include"posix_ipc.h"

int main(int argc,char *argv[])
{
    if(argc<2)
    {
        printf("%s mq\n",argv[0]);
        exit(EXIT_FAILURE);
    }
    mqd_t mq;

    if((mq=mq_open(argv[1],O_RDWR)==(mqd_t)-1))
        err("open");
    if(mq_close(mq)==-1)
        err("mq_close");
    else
        printf("%s closed\n",argv[1]);
    exit(EXIT_SUCCESS);
}
